package com.jingyanzi.member.query;


public class QueryDO {
	
	/** 判断是否分页 */
    private boolean isPage;

    /** 当前页数 */
    private int pageNO;
    
    /** 每页显示数量 */
    private int pageRows;
    
    /** 排序字段 */
 	private String orderByClause;
 	
 	/** 排序方向 */
 	private String sort;
 	
 	/** 需要显示的记录数 */
    private int top;
    
    private Integer uid;

    private Integer mid;
    
    private String nameOrTel;

	public String getOrderByClause() {
		return orderByClause;
	}

	public int getPageNO() {
        return pageNO;
    }

	public int getPageRows() {
        return pageRows;
    }

	public String getSort() {
		if (sort == null || sort.length() == 0) sort = "desc";
		return sort;
	}
    
    /**
 	 * 用于数据库分页查询时,计算起始位置
 	 * @return
 	 */
 	public int getStart() {
 		if (pageNO < 1) pageNO = 1;
 		return (pageNO - 1) * pageRows  ;
 	}
    
    public int getTop() {
        return top;
    }
    

    /**
     * 初始化数据
     * @param pageNO
     * @param pageRows
     * @param order
     * @param sort
     */
    public void initpage(Integer pageNO, int pageRows, String order, String sort) {
    	if (pageNO == null) pageNO = 1;
 		this.pageNO = pageNO;
 		this.pageRows = pageRows;
 		this.orderByClause = order;
 		this.sort = sort;
 	}

    public boolean isPage() {
        return isPage;
    }

    public void setOrderByClause(String orderByClause) {
		this.orderByClause = orderByClause;
	}

    public void setPage(boolean isPage) {
        this.isPage = isPage;
    }

    public void setPageNO(int pageNO) {
        this.pageNO = pageNO;
    }

    public void setPageRows(int pageRows) {
        this.pageRows = pageRows;
    }

    public void setSort(String sort) {
		this.sort = sort;
	}

    public void setTop(int top) {
        this.top = top;
    }

	public String getNameOrTel() {
		return nameOrTel;
	}

	public void setNameOrTel(String nameOrTel) {
		this.nameOrTel = nameOrTel;
	}

	public Integer getUid() {
		return uid;
	}

	public void setUid(Integer uid) {
		this.uid = uid;
	}

	public Integer getMid() {
		return mid;
	}

	public void setMid(Integer mid) {
		this.mid = mid;
	}

}
